<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>社交网站焦点轮播</title>
    <!-- Bootstrap 5 CSS -->
    <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/css/bootstrap.min.css" rel="stylesheet">
    <!-- Font Awesome -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
    
    <style>
        :root {
            --primary-color: #2563eb;
            --primary-light: #dbeafe;
            --secondary-color: #64748b;
            --dark-color: #0f172a;
            --light-color: #f8fafc;
            --overlay-gradient: linear-gradient(to top, rgba(0,0,0,0.8) 0%, rgba(0,0,0,0) 60%);
        }
        
        body {
            font-family: 'Inter', system-ui, sans-serif;
            background-color: var(--light-color);
        }
        
        /* 轮播容器样式 */
        .featured-carousel-container {
            position: relative;
            margin: 20px auto;
            max-width: 1200px;
            box-shadow: 0 4px 20px rgba(0,0,0,0.15);
            border-radius: 12px;
            overflow: hidden;
        }
        
        /* 轮播导航标签 */
        .carousel-tabs {
            display: flex;
            background-color: white;
            border-bottom: 1px solid #e2e8f0;
        }
        
        .carousel-tab {
            padding: 14px 20px;
            flex: 1;
            text-align: center;
            cursor: pointer;
            transition: all 0.3s ease;
            font-weight: 500;
            color: var(--secondary-color);
            border-bottom: 3px solid transparent;
        }
        
        .carousel-tab.active {
            color: var(--primary-color);
            border-bottom-color: var(--primary-color);
            background-color: var(--primary-light);
            background-color: rgba(37, 99, 235, 0.05);
        }
        
        .carousel-tab:hover:not(.active) {
            background-color: #f1f5f9;
        }
        
        .carousel-tab i {
            margin-right: 8px;
            font-size: 1.1em;
        }
        
        /* 轮播内容样式 */
        .carousel-content {
            position: relative;
            height: 450px;
        }
        
        .carousel-slide {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            opacity: 0;
            transition: opacity 0.5s ease;
            overflow: hidden;
        }
        
        .carousel-slide.active {
            opacity: 1;
            z-index: 10;
        }
        
        .carousel-image {
            width: 100%;
            height: 100%;
            object-fit: cover;
            transition: transform 6s ease;
        }
        
        .carousel-slide:hover .carousel-image {
            transform: scale(1.05);
        }
        
        .carousel-caption {
            position: absolute;
            bottom: 0;
            left: 0;
            right: 0;
            padding: 40px 60px;
            color: white;
            background: var(--overlay-gradient);
            z-index: 20;
        }
        
        .carousel-category {
            display: inline-block;
            padding: 4px 12px;
            border-radius: 20px;
            font-size: 0.85rem;
            font-weight: 500;
            margin-bottom: 12px;
            background-color: rgba(255,255,255,0.2);
            backdrop-filter: blur(4px);
        }
        
        .carousel-title {
            font-size: 1.8rem;
            font-weight: 700;
            margin-bottom: 15px;
            line-height: 1.3;
        }
        
        .carousel-meta {
            display: flex;
            align-items: center;
            gap: 20px;
            font-size: 0.9rem;
            opacity: 0.9;
        }
        
        .carousel-meta span {
            display: flex;
            align-items: center;
        }
        
        .carousel-meta i {
            margin-right: 6px;
        }
        
        /* 轮播控制按钮 */
        .carousel-control {
            position: absolute;
            top: 50%;
            transform: translateY(-50%);
            width: 50px;
            height: 50px;
            border-radius: 50%;
            background-color: rgba(0,0,0,0.3);
            color: white;
            border: none;
            display: flex;
            align-items: center;
            justify-content: center;
            font-size: 1.2rem;
            cursor: pointer;
            transition: all 0.3s ease;
            z-index: 30;
        }
        
        .carousel-control:hover {
            background-color: var(--primary-color);
        }
        
        .carousel-prev {
            left: 20px;
        }
        
        .carousel-next {
            right: 20px;
        }
        
        /* 指示器样式 */
        .carousel-indicators {
            position: absolute;
            bottom: 130px;
            left: 50%;
            transform: translateX(-50%);
            display: flex;
            gap: 8px;
            z-index: 30;
        }
        
        .carousel-indicator {
            width: 10px;
            height: 10px;
            border-radius: 50%;
            background-color: rgba(255,255,255,0.5);
            cursor: pointer;
            transition: all 0.3s ease;
        }
        
        .carousel-indicator.active {
            background-color: white;
            width: 30px;
            border-radius: 5px;
        }
        
        /* 响应式调整 */
        @media (max-width: 992px) {
            .carousel-content {
                height: 400px;
            }
            
            .carousel-title {
                font-size: 1.5rem;
            }
            
            .carousel-caption {
                padding: 30px 40px;
            }
        }
        
        @media (max-width: 768px) {
            .carousel-content {
                height: 350px;
            }
            
            .carousel-title {
                font-size: 1.3rem;
            }
            
            .carousel-meta {
                flex-wrap: wrap;
                gap: 10px;
                font-size: 0.85rem;
            }
            
            .carousel-tab span {
                display: none;
            }
            
            .carousel-tab i {
                margin-right: 0;
            }
            
            .carousel-indicators {
                bottom: 110px;
            }
        }
        
        @media (max-width: 576px) {
            .carousel-content {
                height: 300px;
            }
            
            .carousel-title {
                font-size: 1.1rem;
                margin-bottom: 10px;
            }
            
            .carousel-caption {
                padding: 20px 25px;
            }
            
            .carousel-control {
                width: 40px;
                height: 40px;
                font-size: 1rem;
            }
            
            .carousel-indicators {
                bottom: 90px;
            }
        }
    </style>
</head>
<body>
    <div class="container">
        <!-- 焦点轮播组件 -->
        <div class="featured-carousel-container">
            <!-- 轮播标签导航 -->
            <div class="carousel-tabs">
                <div class="carousel-tab active" data-target="articles">
                    <i class="fas fa-newspaper"></i>
                    <span>热门文章</span>
                </div>
                <div class="carousel-tab" data-target="events">
                    <i class="fas fa-calendar-alt"></i>
                    <span>活动</span>
                </div>
                <div class="carousel-tab" data-target="topics">
                    <i class="fas fa-thumbtack"></i>
                    <span>专题</span>
                </div>
            </div>
            
            <!-- 轮播内容区域 -->
            <div class="carousel-content">
                <!-- 热门文章轮播项 -->
                <div class="carousel-group active" id="articles">
                    <div class="carousel-slide active">
                        <img src="https://picsum.photos/id/1015/1200/600" alt="人工智能与未来工作" class="carousel-image">
                        <div class="carousel-caption">
                            <span class="carousel-category">科技前沿</span>
                            <h3 class="carousel-title">人工智能如何重塑未来五年的工作形态与就业市场</h3>
                            <div class="carousel-meta">
                                <span><i class="far fa-user"></i>科技观察家</span>
                                <span><i class="far fa-clock"></i>2023-06-15</span>
                                <span><i class="far fa-eye"></i>12.5k 阅读</span>
                                <span><i class="far fa-comment"></i>236 评论</span>
                            </div>
                        </div>
                    </div>
                    
                    <div class="carousel-slide">
                        <img src="https://picsum.photos/id/1019/1200/600" alt="远程工作效率指南" class="carousel-image">
                        <div class="carousel-caption">
                            <span class="carousel-category">职场技能</span>
                            <h3 class="carousel-title">远程工作效率提升指南：从环境搭建到时间管理</h3>
                            <div class="carousel-meta">
                                <span><i class="far fa-user"></i>职场研究院</span>
                                <span><i class="far fa-clock"></i>2023-06-12</span>
                                <span><i class="far fa-eye"></i>8.7k 阅读</span>
                                <span><i class="far fa-comment"></i>158 评论</span>
                            </div>
                        </div>
                    </div>
                    
                    <div class="carousel-slide">
                        <img src="https://picsum.photos/id/1025/1200/600" alt="极简主义生活" class="carousel-image">
                        <div class="carousel-caption">
                            <span class="carousel-category">生活方式</span>
                            <h3 class="carousel-title">极简主义生活实践：如何通过减少物质欲望提升幸福感</h3>
                            <div class="carousel-meta">
                                <span><i class="far fa-user"></i>生活美学</span>
                                <span><i class="far fa-clock"></i>2023-06-10</span>
                                <span><i class="far fa-eye"></i>9.3k 阅读</span>
                                <span><i class="far fa-comment"></i>189 评论</span>
                            </div>
                        </div>
                    </div>
                </div>
                
                <!-- 活动轮播项 -->
                <div class="carousel-group" id="events">
                    <div class="carousel-slide active">
                        <img src="https://picsum.photos/id/1035/1200/600" alt="科技创新峰会" class="carousel-image">
                        <div class="carousel-caption">
                            <span class="carousel-category">科技会议</span>
                            <h3 class="carousel-title">2023科技创新峰会：AI与元宇宙的未来发展</h3>
                            <div class="carousel-meta">
                                <span><i class="far fa-building"></i>未来科技研究院</span>
                                <span><i class="far fa-calendar"></i>2023-07-15</span>
                                <span><i class="fas fa-map-marker-alt"></i>上海国际会议中心</span>
                                <span><i class="fas fa-users"></i>1200人已报名</span>
                            </div>
                        </div>
                    </div>
                    
                    <div class="carousel-slide">
                        <img src="https://picsum.photos/id/1040/1200/600" alt="城市徒步活动" class="carousel-image">
                        <div class="carousel-caption">
                            <span class="carousel-category">户外活动</span>
                            <h3 class="carousel-title">城市徒步：探索老城区的历史建筑与文化故事</h3>
                            <div class="carousel-meta">
                                <span><i class="far fa-user"></i>城市漫游者</span>
                                <span><i class="far fa-calendar"></i>2023-06-25</span>
                                <span><i class="fas fa-map-marker-alt"></i>北京市东城区</span>
                                <span><i class="fas fa-users"></i>45人已报名</span>
                            </div>
                        </div>
                    </div>
                    
                    <div class="carousel-slide">
                        <img src="https://picsum.photos/id/1050/1200/600" alt="创业分享会" class="carousel-image">
                        <div class="carousel-caption">
                            <span class="carousel-category">创业交流</span>
                            <h3 class="carousel-title">青年创业者分享会：从0到1的创业实战经验</h3>
                            <div class="carousel-meta">
                                <span><i class="far fa-building"></i>创业者联盟</span>
                                <span><i class="far fa-calendar"></i>2023-07-02</span>
                                <span><i class="fas fa-map-marker-alt"></i>线上直播</span>
                                <span><i class="fas fa-users"></i>860人已报名</span>
                            </div>
                        </div>
                    </div>
                </div>
                
                <!-- 专题轮播项 -->
                <div class="carousel-group" id="topics">
                    <div class="carousel-slide active">
                        <img src="https://picsum.photos/id/1060/1200/600" alt="可持续生活" class="carousel-image">
                        <div class="carousel-caption">
                            <span class="carousel-category">生活方式</span>
                            <h3 class="carousel-title">可持续生活指南：从日常小事开始的环保实践</h3>
                            <div class="carousel-meta">
                                <span><i class="fas fa-layer-group"></i>12篇精选文章</span>
                                <span><i class="far fa-clock"></i>更新于 2023-06-18</span>
                                <span><i class="far fa-eye"></i>32.5k 总阅读</span>
                                <span><i class="far fa-bookmark"></i>5.2k 收藏</span>
                            </div>
                        </div>
                    </div>
                    
                    <div class="carousel-slide">
                        <img src="https://picsum.photos/id/1066/1200/600" alt="数字化转型" class="carousel-image">
                        <div class="carousel-caption">
                            <span class="carousel-category">商业管理</span>
                            <h3 class="carousel-title">中小企业数字化转型之路：挑战与解决方案</h3>
                            <div class="carousel-meta">
                                <span><i class="fas fa-layer-group"></i>8篇精选文章</span>
                                <span><i class="far fa-clock"></i>更新于 2023-06-15</span>
                                <span><i class="far fa-eye"></i>25.3k 总阅读</span>
                                <span><i class="far fa-bookmark"></i>4.7k 收藏</span>
                            </div>
                        </div>
                    </div>
                    
                    <div class="carousel-slide">
                        <img src="https://picsum.photos/id/1074/1200/600" alt="心理健康" class="carousel-image">
                        <div class="carousel-caption">
                            <span class="carousel-category">健康养生</span>
                            <h3 class="carousel-title">数字时代的心理健康：对抗焦虑与信息过载</h3>
                            <div class="carousel-meta">
                                <span><i class="fas fa-layer-group"></i>10篇精选文章</span>
                                <span><i class="far fa-clock"></i>更新于 2023-06-12</span>
                                <span><i class="far fa-eye"></i>41.2k 总阅读</span>
                                <span><i class="far fa-bookmark"></i>7.8k 收藏</span>
                            </div>
                        </div>
                    </div>
                </div>
                
                <!-- 轮播控制按钮 -->
                <button class="carousel-control carousel-prev">
                    <i class="fas fa-chevron-left"></i>
                </button>
                <button class="carousel-control carousel-next">
                    <i class="fas fa-chevron-right"></i>
                </button>
                
                <!-- 轮播指示器 -->
                <div class="carousel-indicators">
                    <div class="carousel-indicator active"></div>
                    <div class="carousel-indicator"></div>
                    <div class="carousel-indicator"></div>
                </div>
            </div>
        </div>
    </div>

    <!-- Bootstrap JS -->
    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.0-alpha1/dist/js/bootstrap.bundle.min.js"></script>
    
    <script>
        document.addEventListener('DOMContentLoaded', function() {
            // 获取DOM元素
            const tabs = document.querySelectorAll('.carousel-tab');
            const groups = document.querySelectorAll('.carousel-group');
            const slides = document.querySelectorAll('.carousel-slide');
            const prevBtn = document.querySelector('.carousel-prev');
            const nextBtn = document.querySelector('.carousel-next');
            const indicators = document.querySelectorAll('.carousel-indicator');
            
            // 当前激活的分组和轮播项索引
            let activeGroup = 'articles';
            let currentSlideIndex = 0;
            
            // 自动轮播计时器
            let carouselInterval;
            
            // 初始化轮播
            initCarousel();
            
            // 初始化函数
            function initCarousel() {
                // 启动自动轮播
                startAutoCarousel();
                
                // 为标签添加点击事件
                tabs.forEach(tab => {
                    tab.addEventListener('click', function() {
                        const target = this.getAttribute('data-target');
                        switchGroup(target);
                    });
                });
                
                // 为控制按钮添加点击事件
                prevBtn.addEventListener('click', showPrevSlide);
                nextBtn.addEventListener('click', showNextSlide);
                
                // 为指示器添加点击事件
                indicators.forEach((indicator, index) => {
                    indicator.addEventListener('click', () => {
                        goToSlide(index);
                    });
                });
            }
            
            // 切换分组（热门文章/活动/专题）
            function switchGroup(groupId) {
                // 更新激活的标签
                tabs.forEach(tab => {
                    if (tab.getAttribute('data-target') === groupId) {
                        tab.classList.add('active');
                    } else {
                        tab.classList.remove('active');
                    }
                });
                
                // 更新激活的分组
                groups.forEach(group => {
                    if (group.id === groupId) {
                        group.classList.add('active');
                    } else {
                        group.classList.remove('active');
                    }
                });
                
                // 更新当前激活的分组ID
                activeGroup = groupId;
                
                // 重置当前轮播项索引并更新显示
                currentSlideIndex = 0;
                updateSlideDisplay();
                
                // 重启自动轮播
                restartAutoCarousel();
            }
            
            // 显示上一张轮播
            function showPrevSlide() {
                currentSlideIndex = (currentSlideIndex - 1 + 3) % 3;
                updateSlideDisplay();
                restartAutoCarousel();
            }
            
            // 显示下一张轮播
            function showNextSlide() {
                currentSlideIndex = (currentSlideIndex + 1) % 3;
                updateSlideDisplay();
                restartAutoCarousel();
            }
            
            // 跳转到指定索引的轮播
            function goToSlide(index) {
                currentSlideIndex = index;
                updateSlideDisplay();
                restartAutoCarousel();
            }
            
            // 更新轮播显示状态
            function updateSlideDisplay() {
                // 获取当前分组下的所有轮播项
                const currentSlides = document.querySelectorAll(`#${activeGroup} .carousel-slide`);
                
                // 更新轮播项显示
                currentSlides.forEach((slide, index) => {
                    if (index === currentSlideIndex) {
                        slide.classList.add('active');
                    } else {
                        slide.classList.remove('active');
                    }
                });
                
                // 更新指示器状态
                indicators.forEach((indicator, index) => {
                    if (index === currentSlideIndex) {
                        indicator.classList.add('active');
                    } else {
                        indicator.classList.remove('active');
                    }
                });
            }
            
            // 启动自动轮播
            function startAutoCarousel() {
                carouselInterval = setInterval(showNextSlide, 5000);
            }
            
            // 重启自动轮播（用于用户交互后重置计时器）
            function restartAutoCarousel() {
                clearInterval(carouselInterval);
                startAutoCarousel();
            }
            
            // 鼠标悬停时暂停轮播
            const carouselContainer = document.querySelector('.featured-carousel-container');
            carouselContainer.addEventListener('mouseenter', () => {
                clearInterval(carouselInterval);
            });
            
            // 鼠标离开时恢复轮播
            carouselContainer.addEventListener('mouseleave', () => {
                startAutoCarousel();
            });
        });
    </script>
</body>
</html>
    